<?php

namespace phptools;

use \Fabula, \pTray_Plugin_Abstract, \pTray_Plugin_Interface;

define("PHPTOOLS_PATH", dirname(__FILE__));

require_once(PHPTOOLS_PATH . "/frmObfuscator.php");

/**
 * Plugin de exemplo
 */
class phptools extends pTray_Plugin_Abstract implements pTray_Plugin_Interface {
	/**
	 * Armazena o menu
	 * 
	 * @var GtkMenu
	 */
	private $_menu;
	
	/**
	 * Executado no carregamento
	 */
	public function load() {
		echo "inicio\n";
	}
	
	/**
	 * Executado no termino
	 */
	public function unload() {
		echo "terminou\n";
	}
	
	/**
	 * Inicia o plugin
	 */
	public function run() {
		// Cria o menu
		$this->_menu = $this->append_menu("PHP Tools", PHPTOOLS_PATH . "/images/php_sym.png");
		$this->_menu->append_item("Obfuscate", array($this, "obfuscate_onclick"));
	}
	
	/**
	 * Evento do click do formulário para obfuscar
	 */
	public function obfuscate_onclick($widget) {
		$form = new frmObfuscator();
	}
}
